import java.util.Scanner;
/*给定一个二进制数组 nums ， 计算其中最大连续 1 的个数*/
public class Main {
    public static int seek(int[] nums) {
        int n = nums.length;
        int count = 0;
        int max = 0;
        for (int i = 0; i < n; i++) {
            if (nums[i] == 1) {
                count++;
            } else count = 0;
            max = Math.max(max, count);
        }
        return max;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        int maxone = seek(nums);
        System.out.println(maxone);
    }
}